<template>
  <div class="monthly">
    <div class="title" :class="{ fixed: fixed }">
      <div class="back">
        <van-icon name="arrow-left" @click="$router.push('/home')" />
      </div>
      <div class="title-tabs" v-show="fixed">
        <span>首饰饰品专区</span>
      </div>
    </div>
    <div class="bgimg">
      <!-- <img
          src="http://higuang365.com/public/images/common/activity/electrical/bg4.jpg"
        /> -->
      <!-- <img  src="https://gw.alicdn.com/imgextra/i1/O1CN01g1Z1MB231ol6cVZkV_!!6000000007196-2-tps-1125-446.png?getAvatar=avatar" alt=""> -->
      <img src="http://www.higuang365.com/public/images/common/activity/2303/031.jpg" alt="">
    </div>
    <GoodsList />
  </div>
</template>
<script>
import { reactive, toRefs, nextTick } from "vue";
import GoodsList from "@/components/promotion/ornamentsGoods.vue";
export default {
  name: "electrical",
  components: {
    GoodsList,
  },
  setup() {
    const data = reactive({
      fixed: false,
    });

    nextTick(() => {
      document.getElementById("app").addEventListener("scroll", () => {
        const scrollTop = document.getElementById("app").scrollTop;
        data.fixed = Math.abs(Math.round(scrollTop)) < 300 ? false : true;
      });
    });

    return { ...toRefs(data) };
  },
};
</script>
<style lang="scss" scoped>
.monthly {
  min-height: 100vh;
  background: #05c3f8;

  img {
    display: block;
  }

  .title {
    position: fixed;
    top: 0;
    display: flex;
    width: 100%;
    height: 5rem;
    line-height: 5rem;
    z-index: 100;
    color: #fff;
  }

  .back {
    position: absolute;
    left: 2rem;
    font-size: 2rem;
  }

  .title-tabs {
    margin: auto;
    font-size: 1.8rem;
    font-weight: bold;
    color: #fff;
  }

  .fixed {
    background-image: url("http://www.higuang365.com/public/images/common/promotion/news2.jpg");
    background-size: cover;
    transition: background 0.5s cubic-bezier(0.39, 0.58, 0.57, 1);
  }
}
</style>
  